package com.example.cslp.service.Impl;


import com.example.cslp.mapper.CommentMapper;
import com.example.cslp.pojo.entity.Comment;
import com.example.cslp.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    CommentMapper commentMapper;
    //添加评论
    public ResponseEntity<Boolean> addComment (Comment comment){
        return ResponseEntity.ok(commentMapper.addComment(comment));
    }
    //删除评论
    public Boolean deleteComment(String string){
        return commentMapper.deleteComment(string);
    }

    //查询某门课评论
    public List<Comment> queryComment(Integer c_id){
        return commentMapper.queryComment(c_id);
    }

    //评论点赞

    @Override
    public Boolean yesComment(Integer commentId) {
        return commentMapper.yesComment(commentId);
    }

    //评论点踩
    public Boolean noComment(Integer commentId) {
        return commentMapper.noComment(commentId);
    }
}
